package com.training.admin.entity.search;

import java.util.Map;

import com.demo2do.core.persistence.support.QueryFilter;
import com.demo2do.core.persistence.support.QueryOrder;

/**
 *
 * @author Rockett
 *
 */
public class CourseRecordReportSearch extends ReportSearch {

    /** 课程编号 */
    private String courseCode;
    
    /** 课程姓名 */
    private String courseName;
    /** 讲师编号 */
    private String trainerCode;
    
    /** 讲师姓名 */
    private String trainerName;
    /** 讲师邮箱 */
    private String trainerEmail;
    
    /** 项目名称 */
    private String projectName;
    
    /** 事业部*/
    private Long departmentId;
    

    private QueryFilter filter;
    
    private QueryOrder order;

    
    /**
     * The default constructor
     */
    public CourseRecordReportSearch() {
        order = new QueryOrder("c.course.name", "asc");
    }
    /* (non-Javadoc)
     * @see com.demo2do.core.persistence.support.QueryBuilder#getPreparedFilter(boolean)
     */
    public QueryFilter getPreparedFilter(boolean refresh) {
    	
        if (filter == null || refresh) {
        	
            filter = new QueryFilter().addLike("c.course.code", courseCode)
					.addLike("c.course.name", courseName)
					.addLike("c.trainer.code",trainerCode)
					.addLike("c.trainer.name",trainerName)
					.addLike("c.projectPhase.project.name",projectName)
					.addEquals("c.projectPhase.project.department","id", departmentId)
					.addLike("c.trainer.email",trainerEmail);
            
        }
        
        return filter;
        
    }
    
 
    
    /**
	 * @return the projectName
	 */
	public String getProjectName() {
		return projectName;
	}
	/**
	 * @param projectName the projectName to set
	 */
	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}
	/*
     * (non-Javadoc)
     * @see com.demo2do.core.persistence.support.QueryBuilder#buildSentenceTemplate()
     */
    public String buildSentenceTemplate() {
        String sentence = "FROM ProjectPhaseCourse as c where c.disabled=false " + getPreparedFilter(false).clauseSentence() + order.sentence();
        return sentence;
    }

    /*
     * (non-Javadoc)
     * @see com.demo2do.core.persistence.support.QueryBuilder#buildParameters()
     */
    public Map<String, Object> buildParameters() {
        return getPreparedFilter(false).parameters();
    }
    

    /**
     * 
     * @return
     */
    public QueryFilter getFilter(){
        return getPreparedFilter(false);
    }
	/**
	 * @return the order
	 */
	public QueryOrder getOrder() {
		return order;
	}

	/**
	 * @return the departmentId
	 */
	public Long getDepartmentId() {
		return departmentId;
	}
	/**
	 * @param departmentId the departmentId to set
	 */
	public void setDepartmentId(Long departmentId) {
		this.departmentId = departmentId;
	}
	/**
	 * @return the courseCode
	 */
	public String getCourseCode() {
		return courseCode;
	}
	/**
	 * @param courseCode the courseCode to set
	 */
	public void setCourseCode(String courseCode) {
		this.courseCode = courseCode;
	}
	/**
	 * @return the courseName
	 */
	public String getCourseName() {
		return courseName;
	}
	/**
	 * @param courseName the courseName to set
	 */
	public void setCourseName(String courseName) {
		this.courseName = courseName;
	}
	/**
	 * @return the trainerCode
	 */
	public String getTrainerCode() {
		return trainerCode;
	}
	/**
	 * @param trainerCode the trainerCode to set
	 */
	public void setTrainerCode(String trainerCode) {
		this.trainerCode = trainerCode;
	}
	/**
	 * @return the trainerName
	 */
	public String getTrainerName() {
		return trainerName;
	}
	/**
	 * @param trainerName the trainerName to set
	 */
	public void setTrainerName(String trainerName) {
		this.trainerName = trainerName;
	}
	/**
	 * @return the trainerEmail
	 */
	public String getTrainerEmail() {
		return trainerEmail;
	}
	/**
	 * @param trainerEmail the trainerEmail to set
	 */
	public void setTrainerEmail(String trainerEmail) {
		this.trainerEmail = trainerEmail;
	}



}
